package com.baizhi.cmfz.appcontroller;

import com.baizhi.cmfz.entity.Album;
import com.baizhi.cmfz.service.AlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/album")
public class AlbumController {
    @Autowired
    private AlbumService albumService;
    @RequestMapping("/selectAlbum")
    @ResponseBody
    public List<Album>selectAlbum(){

        return albumService.selectAlbum();
    };
    @RequestMapping("/selectAllAlbum/{count}")
    @ResponseBody
    public  List<Album>selectAllAlbum(@PathVariable("count") Integer count){
        //0 代表查询所有
        return  albumService.selectAlbum();
    }
    @GetMapping("/selectAudio/{albumId}")
    @ResponseBody
    public  List<Album>selectAudio(@PathVariable("albumId") Integer albumId){

        return  albumService.selectAudio(albumId);
    }
    @RequestMapping("/selectOneAlbum/{id}")
    @ResponseBody
    public  Album selectOneAlbum(@PathVariable("id") Integer id){

        return  albumService.selectOneAlbum(id);
    }
}
